import React, { Component } from 'react'
// import qs from 'querystring'

const detailData = [
    { id:'1',content:'内容1呢' },
    { id:'2',content:'内容2呢' },
    { id:'3',content:'内容3呢' }
]    

export default class index extends Component {
    render() {
        {/* **search**传参 */}
        // const {search} = this.props.location
        // const {id,title} = qs.parse(search.slice(1)) //parse是把id=1&title=1转换成为id:'1',title:'1'   slice除去第一位

        const {id,title} = this.props.location.state
        const findResult =detailData.find((item)=>{
            return item.id === id  
        })
        return (
            <div>
                <ul>
                    <li>id:{id}</li>
                    <li>title:{title}</li>
                    <li>content:{findResult.content}</li>
                </ul>
            </div>
        )
    }
}
